<cfcomponent extends="Controller">	
	<cffunction name="deleteDocumentItem">
		<cfscript>
			deleteMessage = Replace(Replace("#humanize(PARAMS.table)# [strong]has been successfully deleted![/strong]", "[", "<", "All"), "]", ">", "All");

			documentItem = model(PARAMS.table).findByKey(PARAMS.key);
			flashInsert(admin=deleteMessage);
			documentItem.delete();
			renderWith(documentItem);
		</cfscript>
	</cffunction>
	
	<cffunction name="updateDocumentItem">
		<cfscript>
			createMessage = "";

			if(StructKeyExists(PARAMS, "insert")) {
				createMessage &= '[div]You have successfully [strong]updated[/strong] the following document types:[ul]';
				for($table IN PARAMS.insert) {
					for($intRow IN PARAMS.insert[$table]) {
						$settingType = Model($table).create(PARAMS.insert[$table][$intRow]);					
					}
					createMessage &= "[li]#humanize($table)#[/li]";
				}
				createMessage &= '[/ul][/div]';
				
			}

			adminMessage = Replace(Replace(createMessage, "[", "<", "All"), "]", ">", "All");
			flashInsert(admin=adminMessage);
			renderWith($settingType);
		</cfscript>
	</cffunction>
</cfcomponent>